<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SSD1306Ascii: AvrI2c Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">SSD1306Ascii
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_avr_i2c-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">AvrI2c Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Hardware I2C master class for AVR.  
 <a href="class_avr_i2c.html#details">More...</a></p>

<p><code>#include &lt;AvrI2c.h&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:af28f45a93eb2553a935889c9cbdb42b6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_avr_i2c.html#af28f45a93eb2553a935889c9cbdb42b6">begin</a> (bool fastMode=true)</td></tr>
<tr class="memdesc:af28f45a93eb2553a935889c9cbdb42b6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize prescalar and SLC clock rate.  <a href="#af28f45a93eb2553a935889c9cbdb42b6">More...</a><br /></td></tr>
<tr class="separator:af28f45a93eb2553a935889c9cbdb42b6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acbe619382b96fe1899bbdf0d808aa124"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_avr_i2c.html#acbe619382b96fe1899bbdf0d808aa124">read</a> (bool last)</td></tr>
<tr class="memdesc:acbe619382b96fe1899bbdf0d808aa124"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read a byte and send Ack if more reads follow else Nak to terminate read.  <a href="#acbe619382b96fe1899bbdf0d808aa124">More...</a><br /></td></tr>
<tr class="separator:acbe619382b96fe1899bbdf0d808aa124"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abf256161193de9acb2235a52a8b422a0"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_avr_i2c.html#abf256161193de9acb2235a52a8b422a0">repeatedStart</a> (uint8_t addressRW)</td></tr>
<tr class="memdesc:abf256161193de9acb2235a52a8b422a0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Issue a repeated start condition.  <a href="#abf256161193de9acb2235a52a8b422a0">More...</a><br /></td></tr>
<tr class="separator:abf256161193de9acb2235a52a8b422a0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3cb4edb470edc3871e496f36ad1a93e8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_avr_i2c.html#a3cb4edb470edc3871e496f36ad1a93e8">setClock</a> (uint32_t frequency)</td></tr>
<tr class="memdesc:a3cb4edb470edc3871e496f36ad1a93e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the I2C bit rate.  <a href="#a3cb4edb470edc3871e496f36ad1a93e8">More...</a><br /></td></tr>
<tr class="separator:a3cb4edb470edc3871e496f36ad1a93e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6c09b71a962bf50a2feb0ea7517e1178"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_avr_i2c.html#a6c09b71a962bf50a2feb0ea7517e1178">start</a> (uint8_t addressRW)</td></tr>
<tr class="memdesc:a6c09b71a962bf50a2feb0ea7517e1178"><td class="mdescLeft">&#160;</td><td class="mdescRight">Issue a start condition.  <a href="#a6c09b71a962bf50a2feb0ea7517e1178">More...</a><br /></td></tr>
<tr class="separator:a6c09b71a962bf50a2feb0ea7517e1178"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a80d640974c7cdba083d3673dc675cd5b"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_avr_i2c.html#a80d640974c7cdba083d3673dc675cd5b">status</a> (void)</td></tr>
<tr class="separator:a80d640974c7cdba083d3673dc675cd5b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a54ade98bafbc7803530ee3df64ae05bb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_avr_i2c.html#a54ade98bafbc7803530ee3df64ae05bb">stop</a> (void)</td></tr>
<tr class="separator:a54ade98bafbc7803530ee3df64ae05bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aee33451c8f3a34320975eb6845aab084"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_avr_i2c.html#aee33451c8f3a34320975eb6845aab084">write</a> (uint8_t data)</td></tr>
<tr class="memdesc:aee33451c8f3a34320975eb6845aab084"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a byte.  <a href="#aee33451c8f3a34320975eb6845aab084">More...</a><br /></td></tr>
<tr class="separator:aee33451c8f3a34320975eb6845aab084"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Hardware I2C master class for AVR. </p>
<p>Uses ATmega TWI hardware port </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="af28f45a93eb2553a935889c9cbdb42b6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af28f45a93eb2553a935889c9cbdb42b6">&#9670;&nbsp;</a></span>begin()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void AvrI2c::begin </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>fastMode</em> = <code>true</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Initialize prescalar and SLC clock rate. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">fastMode</td><td>Fast 400 kHz mode if true else standard 100 kHz mode. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="acbe619382b96fe1899bbdf0d808aa124"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acbe619382b96fe1899bbdf0d808aa124">&#9670;&nbsp;</a></span>read()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t AvrI2c::read </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>last</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Read a byte and send Ack if more reads follow else Nak to terminate read. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">last</td><td>Set true to terminate the read else false. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The byte read from the I2C bus. </dd></dl>

</div>
</div>
<a id="abf256161193de9acb2235a52a8b422a0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abf256161193de9acb2235a52a8b422a0">&#9670;&nbsp;</a></span>repeatedStart()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool AvrI2c::repeatedStart </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>addressRW</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Issue a repeated start condition. </p>
<p>same as start with no stop. Included to document intention.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">addressRW</td><td>I2C address with read/write bit. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The value true, 1, for success or false, 0, for failure. </dd></dl>

</div>
</div>
<a id="a3cb4edb470edc3871e496f36ad1a93e8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3cb4edb470edc3871e496f36ad1a93e8">&#9670;&nbsp;</a></span>setClock()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void AvrI2c::setClock </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>frequency</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set the I2C bit rate. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">frequency</td><td>Desired frequency in Hz. Valid range for a 16 MHz board is about 40 kHz to 444,000 kHz. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a6c09b71a962bf50a2feb0ea7517e1178"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6c09b71a962bf50a2feb0ea7517e1178">&#9670;&nbsp;</a></span>start()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool AvrI2c::start </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>addressRW</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Issue a start condition. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">addressRW</td><td>I2C address with read/write bit.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The value true for success or false for failure. </dd></dl>

</div>
</div>
<a id="a80d640974c7cdba083d3673dc675cd5b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a80d640974c7cdba083d3673dc675cd5b">&#9670;&nbsp;</a></span>status()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t AvrI2c::status </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<dl class="section return"><dt>Returns</dt><dd>status from last TWI command - useful for library debug </dd></dl>

</div>
</div>
<a id="a54ade98bafbc7803530ee3df64ae05bb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a54ade98bafbc7803530ee3df64ae05bb">&#9670;&nbsp;</a></span>stop()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void AvrI2c::stop </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Issue a stop condition. </p>

</div>
</div>
<a id="aee33451c8f3a34320975eb6845aab084"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aee33451c8f3a34320975eb6845aab084">&#9670;&nbsp;</a></span>write()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool AvrI2c::write </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>data</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Write a byte. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>The byte to send.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The value true, 1, if the slave returned an Ack or false for Nak. </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>Arduino/libraries/SSD1306Ascii/src/utility/<a class="el" href="_avr_i2c_8h.html">AvrI2c.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sat Sep 7 2019 06:47:25 for SSD1306Ascii by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
